#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exception tree"""
__author__ = "Lei Chen <hide1713@gmail.com>"

class GException(Exception):
    """Base Exception
    """
    
    def __init__(self, msg = "" ):
        """Base constructor
        """
        Exception.__init__(self)
        self._msg = msg

    def _set_msg(self, value):
        self._msg = value
        
    def _get_msg(self):
        return self._msg
        
    msg = property(_get_msg, _set_msg)

class GReadFileException(GException):
    """Read File Exception
    """
    def __init__(self, file_name, line_num, msg):
        """Constructor
        
        Arguments:
        - `file_name`: name of the file
        - `line_num`: line number
        - `msg`: error message
        """
        GException.__init__(self)
        assert(isinstance(file_name,str))
        assert(isinstance(line_num,int))
        assert(isinstance(msg,str))
        self._msg = "File:"+file_name+"\nLine:"+\
                    str(line_num)+"\nError:"+msg
        
class GCogNotFindException(GException):
    """COG name is not in the cog map
    """
    def __init__(self, cog_name):
        """
        
        Arguments:
        - `cog_name`: the cog name is not in cog map
        """
        GException.__init__(self)
        self._msg = "The COG:" + cog_name + " is not in cog map"
        
        
        


        

        
        

